package study.demo.MES;

import lombok.Getter;

/**
 * @author :小马
 * @date : 2024-04-12
 */

@Getter
public enum BusinessExceptionEnum {


    /**
     * 通用失败
     */
    ORDINARY_FAIL(500001, "操作失败"),

    CRAFTS_NUMBER_REPEAT(500601, "生产工艺编号不能重复"),
    CRAFTS_PRODUCT_DELETE(500602, "所选产品已被删除"),
    CRAFTS_NO_EXIST(500603, "找不到工艺信息"),
    CRAFTS_IS_CONFIGURE(500604, "当前工艺存在正在进行的工艺配置"),
    CRAFTS_HAVE_VERSION(500605, "当前工艺已存在版本信息，不能删除。"),
    CRAFTS_VERSION_NOT_NOT_EFFECTIVE(500606, "当前版本的生效状态不是未生效，不能删除。"),
    CRAFTS_LOCK(200, "锁定人名称"),
    CRAFTS_NODE_PROCEDURE_REPEAT(500608, "工序名称在同一工艺版本中不能重复"),
    CRAFTS_NODE_CHECKPOINTS_REPEAT(500609, "检查点名称在同一工艺版本中不能重复"),
    CRAFTS_STEP_REPEAT(500610, "步骤名称在同一工序中不能重复"),
    CRAFTS_HAVE_DEACTIVATE_MATERIAL(500611, "存在停用的物料"),
    CRAFTS_HAVE_ERROR_DEVICE(500612, "存在异常设备"),
    CRAFTS_NO_VERSION(500613, "没有版本信息"),
    CRAFTS_VALIDITY_TIME_ERROR(500614, "生效时间不应该小于当前生效版本的生效时间"),
    CRAFTS_LOCK_ERROR(500615, "锁定人名称"),
    CRAFTS_PROCESS_ERROR(500616, "有问题的节点名字"),
    RECORD_LOCK(500617, "锁定人名称"),
    CRAFTS_LINE_REPEAT(500618, "流程线重复"),

    //资源管理-设备信息
    DEVICE_REFERENCED(500901, "当前设备已被工艺信息引用过，不能删除"),
    DEVICE_QUERY_LIMIT_LENGTH(500902, "查询条件限长为3"),
    DEVICE_NOT_LEAST_DEPT(500903, "不是最低一级部门，请处理后重试"),
    DEVICE_NOT_REPETITION(500904, "设备编码不能重复"),
    DEVICE_DEPT_DELETE(500905, "所选部门已被删除"),
    DEVICE_ADMIN_DELETE(500906, "所选设备管理员已被删除"),
    DEVICE_STORAGE_SPACE_DELETE(500907, "所选存放空间已被删除"),
    DEVICE_NOT_SELECT(500908, "请选择设备"),
    DEVICE_CALIBRATION_LIMIT(500909, "一次最多可为" + 10 + "台设备设置校准有效期"),
    DEVICE_NOT_EXIST(500910, "有设备信息不存在，请刷新再试"),
    DEVICE_NOT_EMPTY(500911, "数据不能为空"),
    DEVICE_MANUFACTURER_REPETITION(500912, "该设备生产商名称已存在"),
    DEVICE_MODEL_REPETITION(500919, "该设备型号已存在"),

    //同步修改数据错误码
    SYNCHRONOUS_MODIFICATION_INSPECTION_LIST(500913, "同步修改工艺工序送检清单失败"),
    SYNCHRONOUS_MODIFICATION_DEVICE_LIST(500914, "同步修改工艺工序设备清单失败"),
    SYNCHRONOUS_MODIFICATION_PRODUCT_LIST(500915, "同步修改工艺工序产物清单失败"),
    SYNCHRONOUS_MODIFICATION_FUNDAMENTAL_PROCESS(500916, "同步修改工艺基础失败"),
    SYNCHRONOUS_MODIFICATION_PRODUCT_INFORMATION(500917, "同步修改产物信息失败"),
    SYNCHRONOUS_MODIFICATION_PRODUCT_BASIC_INFORMATION(500918, "同步修改产品基础信息失败"),


    //产品管理相关错误码
    PRODUCT_NO_EXIST(500701, "产品编号不能重复"),
    PRODUCT_REFERENCED(500702, "当前产品信息已关联过生产工单或生产工艺，不能删除。"),
    PRODUCT_NOT_LEAST_DEPT(500703, "不是最低一级部门，请处理后重试"),
    PRODUCT_UNIT_REMOVED(500704, "产物单位已被删除,请核对后再试!"),
    PRODUCT_ID_ERROR(500705, "产品ID错误,查询产品信息为空"),
    PRODUCT_IDENTIFICATION_REMOVED(500706, "产物已被删除,请核对后再试!"),
    PRODUCT_DEPT_STORAGE_TYPE(500707, "每个生产部门对每种仓储类型至多只能配置一条送存信息"),

    //资源管理-空间位置相关错误码
    SPATIAL_NAME_EXIST(500711, "空间名称不能重复"),
    SPATIAL_LOCATION_REFERENCED_DEVICE(500712, "您正在操作的数据已被设备引用过，不能删除"),
    SPATIAL_LOCATION_REFERENCED_LOCATION(500713, "您正在操作的数据已被位置引用过，不能删除"),
    SPATIAL_LOCATION_ID_ERROR(500714, "ID错误,查询空间或位置信息为空"),
    SPATIAL_LOCATION_DELETE_ERROR(500714, "删除失败,信息不存在"),
    SAME_SPATIAL_LOCATION_NAME_EXIST(500715, "同一空间内的位置名称不能重复"),
    GEOGRAPHIC_LOCATION_LOCATION_NAME_EXIST(500716, "地理位置对应的位置名称不能重复"),


    //物料管理错误代码
    EXCEL_FILEFORMAT_NO_CONFORM(500801, "文件格式有误,请检查上传文件格式!!"),
    EXCEL_MODEL_NO_EXIST(500802, "导入空模板，请重新导入!!"),
    EXCEL_EXPLAIN_FAIL(500803, "文件解释异常!!"),
    EXCEL_DOWNLOAD_FAIL(500804, "下载EXCEL文件异常!!"),
    MATERIAL_QUERY_FAIL(500805, "查询物料基础信息异常!!"),
    MATERIAL_QUERY_BYID_FAIL(500806, "根据ID查询物料基础信息异常!!"),
    MATERIAL_QUERY_BYCOMPANYID_FAIL(500807, "根据企业查询物料基础信息异常!!"),
    MATERIAL_DISABLE_NOT_EXIST(500808, "物料有变更，请刷新页面重试!!"),
    MATERIAL_DISABLE_ERROR(500809, "物料禁用异常!!"),
    MATERIAL_MANUFACTURER_CREATE_ERROR(500810, "创建物料生产商异常!!"),
    MATERIAL_MANUFACTURER_REPEAT(500811, "创建失败：物料生产商已存在!"),
    MATERIAL_UNIT_CREATE_ERROR(500812, "创建物料生产单位异常!!"),
    MATERIAL_UNIT_REPEAT(500813, "创建失败：物料生产单位已存在!"),
    MATERIAL_DETAIL_BYID(500814, "获取物料详情异常!"),
    MATERIAL_DISABLE_CHANGE_UNIT(500815, "物料被工序的物料清单引用时，不可以换单位!!"),
    MATERIAL_UPDATE_ERROR(500816, "编辑物料异常!!"),
    MATERIAL_QUERY_MANUFACTURER_BYCOMPANYID(500817, "获取物料生产商异常!!"),
    MATERIAL_QUERY_UNIT_BYCOMPANYID(500818, "获取物料生产单位异常!!"),
    //物品标识错误代码
    IDENTIFICATION_ARTICLE_SAVE(500819, "创建物品标识失败!"),
    IDENTIFICATION_ARTICLE_RELATION(500820, "校验物品标识是否被引用异常!"),
    IDENTIFICATION_ARTICLE_NO_EXITS(500821, "物品标识有变更，请刷新页面重试!"),
    IDENTIFICATION_ARTICLE_HAD_RELATION(500822, "数据已关联业务数据无法删除!"),
    IDENTIFICATION_ARTICLE_DEL(500823, "删除物品标识异常!"),
    IDENTIFICATION_ARTICLE_RELATION_UPDATE(500824, "数据已关联业务数据不能更新物品类型及标识体系!"),
    IDENTIFICATION_ARTICLE_UPDATE(500825, "物品标识编辑异常!"),
    IDENTIFICATION_ARTICLE_QUERY(500826, "物品标识查询异常!"),
    //体系管理错误代码
    IDENTIFICATION_SYSTEM_EXIST(500827, "体系名称已存在!"),
    IDENTIFICATION_SYSTEM_CREATE(500828, "创建标识体系异常!"),
    IDENTIFICATION_SYSTEM_NOT_EXIST(500829, "体系名称已更新请刷新页面!"),
    IDENTIFICATION_SYSTEM_UPDATE(500830, "编辑标识体系异常!"),
    IDENTIFICATION_SYSTEM_COPY(500831, "复制标识体系异常!"),
    IDENTIFICATION_SYSTEM_HAD_RELATION(500832, "当前标识体系信息已被产品信息引用过!"),
    IDENTIFICATION_SYSTEM_DEL(500833, "删除标识体系信息异常!"),
    IDENTIFICATION_SYSTEM_QUERY(500834, "标识体系查询异常!"),
    IDENTIFICATION_SYSTEM_SELECT_QUERY(500835, "标识体系下拉框异常!"),
    IDENTIFICATION_DESIGNATION_SELECT_BYSYSTEMID(500836, "体系下标识名称下拉框异常!"),
    //标识管理错误代码
    IDENTIFICATION_DESIGNATION_QUERY(500837, "查询标识名称异常!"),
    IDENTIFICATION_DESIGNATION_EXIST(500838, "标识名称已存在!"),
    IDENTIFICATION_DESIGNATION_CREATE(500839, "添加标识名称异常!"),
    IDENTIFICATION_DESIGNATION_NOT_EXIST(500840, "标识名称数据已更新请刷新页面!"),
    IDENTIFICATION_DESIGNATION_UPDATE(500841, "编辑标识名称异常!"),
    IDENTIFICATION_DESIGNATION_DEL(500842, "删除标识名称异常!"),
    IDENTIFICATION_DESIGNATION_SELECT_QUERY(500843, "查询标识名称下拉框异常!"),
    IDENTIFICATION_DESIGNATION_RELEVANCE_ARTICLE_IDENTIFICATION(500895, "当前标识名称已被物品标识引用过!"),
    //工艺物料清单错误代码
    CRAFTSMATERIAL_QUERY(500844, "查询工艺物料清单信息异常!"),
    CRAFTSMATERIAL_NOT_EXIST(500845, "工艺物料清单信息有变更请刷新页面再试!"),
    CRAFTSMATERIAL_SELECT_QUERY(500846, "查询工艺物料清单中的物料信息异常!"),
    CRAFTSMATERIAL_CHECK(500847, "工艺物料清单中有重复的物料或者物料清单中的物料超出上限!"),

    //工艺设备清单错误代码
    CRAFTSDEVICE_QUERY(500848, "查询工艺设备清单信息异常!"),
    CRAFTSDEVICE_NOT_EXIST(500849, "工艺设备清单有变更请刷新页面再试!"),
    CRAFTSDEVICE_CHECK(500850, "工艺设备清单中有重复的设备或者设备清单中的设备超出上限!"),

    //工艺送检清单清单错误代码
    CRAFTSCHECK_NOT_EXIST(500851, "工艺送检清单有变更请刷新页面再试!"),
    CRAFTSCHECK_QUERY(500852, "查询工艺送检清单异常!"),
    CRAFTSCHECK_CHECK(500853, "工艺送检清单超出上限!"),
    //产物清单信息错误代码
    PROCEDURERESULT_NOT_EXIST(500854, "产物清单信息有变更请刷新页面再试!"),
    PROCEDURERESULT_QUERY(500855, "查询产物清单信息异常!"),
    PROCEDURERESULT_CHECK(500856, "产物清单信息超出上限!"),
    //检测指标
    DETECTIONINDEX_CHECK(500857, "检测指标校验不过"),
    DETECTIONINDEX_NOT_EXIST(500858, "检测指标数据有更新请刷新页面重试!"),
    DETECTIONINDEX_RELATION(500859, "检测指标数据被项目引用无法删除!"),
    DETECTIONINDEX_QUERY(500860, "查询检测指标异常!"),
    //业务参数错误代码
    PARAMSERVICE_QUERY(500861, "查询业务参数异常!"),
    PARAMSERVICE_DETAIL_QUERY(500862, "查询业务参数值异常!"),
    PARAMSERVICE_NOT_EXIST(500863, "业务参数值有更新请刷新页面再试!"),
    PARAMSERVICE_EXIST(500864, "业务参数值有重复!"),
    PARAMSERVICE_DETAIL_EXIST(500865, "业务详情参数值有重复!"),
    PARAMSERVICE_DETAIL_NOT_EXIST(500866, "业务详情参数值有更新请刷新页面再试!"),
    //检测项目错误代码
    SYSTEM_DETECTION_ITEM_REPEAT(500867, "检测项目代码重复!"),
    SYSTEM_DETECTION_ITEM_NOT_EXIST(500868, "检测项目有更新请刷新页面再试!"),
    SYSTEM_DETECTION_ITEM_QUERY(500869, "查询检测项目异常!"),
    SYSTEM_DETECTION_ITEM_DEL_RELATION(500870, "当前检测项目信息已被送检单或生产工艺的送检清单关联，不能删除!"),
    //补充的：
    CRAFTSMATERIAL_SAME_MATERIAL(500871, "工艺物料清单中有重复的物料!"),
    CRAFTSMATERIAL_BROKEN_LIMIT(500872, "者物料清单中的物料超出上限!"),
    PARAMSERVICE_PARAM_ID_NOT_EXIST(500873, "业务参数不存在!"),
    IDENTIFICATION_DESIGNATION_LIMIT(500874, "超出标识上限!"),
    FATHER_DEPATR_VALIDATE(500875, "该部门已关联产品信息或检测项目，不能作为上级部门"),

    DEPART_AND_PRODUCT_RELATION(500876, "部门与产品信息有关联,不能作为上级部门"),
    DEPART_AND_ITEM_RELATION(500877, "部门与检测项目有关联,不能作为上级部门"),
    DEPART_AND_DEVICATION_RELATION(500878, "部门与设备信息有关联"),
    PARAM_DETAIL_PRODUCT_EXIST(500879, "产品引用过"),
    PARAM_DETAIL_CRAFTS_BASE_EXIST(500880, "工艺基础信息引用过"),
    PARAM_DETAIL_CRAFTS_NODE_EXIST(500881, "工艺节点引用过"),
    PARAM_DETAIL_CRAFTS_PROCEDURECHECK_EXIST(500882, "工艺工序送检清单引用过"),
    PARAM_DETAIL_CRAFTS_PROCEDURERESULT_EXIST(500883, "工艺工序产物清单引用过"),
    PARAM_DETAIL_SPATIALINFO_EXIST(500884, "空间信息引用过"),
    DETECTIONINDEX_RESULT_ASSEMBLE(500885, "超过检测结果集合上限"),
    PARAM_DETAIL_HAVE_BEEN_CITED(500896, "您当前操作的内容已被引用过，不能删除"),

    DETECTIONINDEX_CHECK_SAME_NAME(500886, "检测指标名称不能相同"),
    DETECTIONINDEX_CHECK_ASSEMBLE_BLANK(500887, "类型为定性时检测结果集合不能为空"),
    DETECTIONINDEX_CHECK_DEFAULT_VALUE(500888, "默认值要属于检测结果类型集合中的某项"),
    DETECTIONINDEX_CHECK_NORMAL_VALUE(500889, "正常值要属于检测结果类型集合中的某项"),
    IDENTIFICATION_ARTICLE_SAME_NAME(500890, "同一标识体系下,物品类型相同时,物品名称不能重复!"),
    IDENTIFICATION_SYSTEM_IDENTIFICATION_ARTICLE_RELATION(500891, "当前标识体系信息已被物品标识引用过!"),
    IMPORT_MATERIAL_NULL_DATA(500892, "物料导入不能为空"),
    CHECK_MATERIAL_SINGLE_NULL_DATA(500893, "工序物料清单中的单份用量不能为空，请先处理不满足此条件的工序:"),
    REMART_MATERIAL_EXCEL_ERROR(500894, "回写导入失败的记录异常"),
    //895 上面已用
    CHECK_SORT_REPEAT(500897, "排序序号重复"),
    CHECK_MATERIAL_IN_ITEM(500898, "物料清单与送检清单关联了"),
    CHECK_MATERIAL_IN_RESULT(500899, "物料清单与产物清单关联了"),
    CHECK_PARAM_DETAIL_DETECTION_INDEX(500900, "参数值与检测指标关联了"),
    CHECK_MATERIAL_RELATION_CRAFTS(500999, "当前物料已被工艺信息引用,不能删除"),

    //样本管理错误代码
    SAMPLE_DETAIL_EMPTY(501001, "样本详情列表不能为空"),
    SAMPLE_CREATE_FAIL(501002, "创建样本失败"),
    SAMPLE_CODE_EMPTY(501003, "关键原材料编码不能为空"),
    SAMPLE_NOT_FOUND(501004, "未找到相关样本"),
    SAMPLE_CODE_REQUIRED(501005, "样本编码不能为空"),
    SAMPLE_INSUFFICIENT(501006, "样本数量不足，无法与所有产品编码匹配"),

    NO_PRODUCT_INFO(501007, "未找到产品信息"),

    //样本接收单错误代码
    RECEIPT_FORM_CREATE_FAIL(501101, "创建样本接收单失败"),
    RECEIPT_FORM_ID_EMPTY(501102, "接收单ID不能为空"),
    RECEIPT_FORM_NOT_EXIST(501103, "接收单不存在"),

    //任务管理错误代码
    TASK_PERSON_NOT_ASSIGN(501201, "当前用户没有分派过"),
    TASK_NOT_EXIST(501202, "任务不存在"),
    WORK_ORDER_NOT_EXIST(501203, "工单不存在"),
    TASK_RECORD_EXIST_USER_LOCK(501204, "员工姓名”已锁定生产记录，需要其先退出记录(在记录页面点击返回即可)"),
    USER_NOT_EXIST(501205, "用户不存在"),
    TASK_ALREADY_COMPLETED(501206, "任务已经完成，请刷新页面"),
    TASK_ALREADY_CANCELED(501207, "任务已经取消，请刷新页面"),
    TASK_NOT_FIRST(501208, "请按照工艺流程执行生产任务"),
    TASK_EXECUTE_USER_NOT_EXIST(501209, "任务执行人信息不存在"),
    TASK_ALREADY_CHECKED(501210, "已核验，无需重复"),
    TASK_NOT_FOUND(501211, "未检索到对应的生产任务"),
    TASK_CONDITIONS_ARE_NOT_FILLED_IN(501212, "记录条件没有填写"),
    TASK_CONDITIONS_Contrast_TYPE_FASLE(501213, "记录条件类型错误"),
    TASK_CONDITIONS_Contrast_TYPE_NULL(501214, "没有此记录条件对比类型"),

    //生产日程错误代码
    PRODUCTION_SCHEDULE_ALREADY_EXIST(501301, "该序列已经存在日程信息，请勿重复创建"),
    PRODUCTION_SCHEDULE_NOT_EXIST(501302, "该序列没有日程信息"),
    PRODUCTION_SCHEDULE_NOT_ALL_FINISH(501303, "该序列的生产任务进行中"),
    PRODUCTION_RECORD_EXIST(501304, "生产任务存在执行记录"),
    PRODUCTION_SEQUENCE_NOT_EXIST(501305, "序列不存在"),
    PRODUCTION_SEQUENCE_STATUS_UPDATE_FAIL(501306, "序列状态修改失败"),
    PRODUCTION_SEQUENCE_FLOW_NOT_EXIST(501307, "日程流转关系不存在"),

    // 生产记录
    PRODUCTION_LOCK_NOT_EXIST(502001, "任务不属于当前操作人"),
    PRODUCTION_MATERIAL_LIST_BATCH_ON_SELECT(502002, "以无多余的物料批次可选择"),
    PRODUCTION_MATERIAL_LIST_BATCH_REPEAT(502003, "物料批次重复选择"),
    PRODUCTION_DEVICE_LIST_CODE_REPEAT(502004, "设备编号重复选择"),
    PRODUCTION_ATTACHEMNT_REPEAT(502005, "文件已存在,不能重复上传"),
    PRODUCTION_CELL_CODE_REPEAT(502006, "细胞编码重复"),
    PRODUCTION_CELL_FILE_NOT_PRINT(502007, "当前文件无法打印"),
    PRODUCTION_LOCK_ERROR(502008, "锁定人名称"),

    PRODUCTION_PARAM_REQUIRED(502009, "必填参数未填写"),
    PRODUCTION_MATERIAL_REQUIRED(502010, "必填参数未填写"),
    PRODUCTION_DEVICE_REQUIRED(502011, "必填参数未填写"),
    PRODUCTION_CHECKLIST_REQUIRED(502012, "必填参数未填写"),
    PRODUCTION_RESULT_CELL_REQUIRED(502013, "必填参数未填写"),
    PRODUCTION_MATERIAL_INVENTORY_REQUIRED(502014, "库存不足"),
    PRODUCTION_MATERIAL_DEDUCTION_INVENTORY_FAIL(502015, "扣减库存失败"),
    PRODUCTION_DEVICE_TIME_CONFLICT_IN_USE(502016, "设备使用时间冲突"),
    PRODUCTION_SIGN_ERROR(502017, "签名失败"),

    // 工序导入
    IMPORT_NOT_EXCEL(502018, "上传的文件不是excel"),
    IMPORT_STEP_NULL(502019, "步骤名称不能为空"),
    STEP_INCONSISTENT(502020, "导入的步骤数据与已有步骤数据不一致，请调整后重试"),
    HUA_MIN(502021, "提交数据到送存出现异常，请联系相关人员"),
    WEI_TAO(502022, "调用任务完成接口异常，请联系相关人员"),

    //工单
    WORK_ORDER_CREATED_FAIL(512001, "工单创建失败"),
    WORK_ORDER_EXPAND_STORAGE_FAIL(512002, "工单扩存失败"),
    WORK_ORDER_CONTRACT_CHANGE_NOTICE_FAIL(512003, "合同变更消息通知失败"),
    WORK_ORDER_CONTRACT_CANCEL_NOTICE_FAIL(512004, "合同取消消息通知失败"),
    WORK_ORDER_CONTRACT_CANCEL_PROCESS_COMPLETED_NOTICE_FAIL(512005, "合同取消流程结束通知消息失败"),
    ;


    /**
     * 错误代码
     */
    private int status;

    /**
     * 错误消息
     */
    private String msg;

    BusinessExceptionEnum(int status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}